<div class="layuimini-main">

    <div class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">疾病助记编码：</label>
            <div class="layui-input-block">
                <input type="text" name="diseaseCode" lay-verify="required" lay-reqtext="疾病助记编码不能为空" placeholder="请输入疾病助记编码"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">疾病名称：</label>
            <div class="layui-input-block">
                <input type="text" name="diseaseName" lay-verify="required" lay-reqtext="疾病名称不能为空" placeholder="请输入疾病名称"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">国际ICD编码：</label>
            <div class="layui-input-block">
                <input type="text" name="diseaseIcd" lay-verify="required" lay-reqtext="国际ICD编码不能为空" placeholder="请输入国际ICD编码"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">疾病分类编号：</label>
            <div class="layui-input-block">
                <input type="number" name="diseCategoryId" lay-verify="required" lay-reqtext="疾病所属分类不能为空" placeholder="请输入疾病所属分类"
                    value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        /**
        * 初始化表单，要加上，不然刷新部分组件可能会不加载
        */
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index1 = layer.load(2);
            $.get("/api/dise/add.json", data.field, function (data) {
                layer.close(index1);
                if (data.code == 0) {
                    var index = layer.alert(data.msg, {
                        title: '错误信息',
                        icon: 2
                    });
                } else {
                    layer.close(parentIndex);
                }
            }, "json");
            return false;
        });

    });
</script>